package zcj.stu;

import lombok.Data;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.servlet.ModelAndView;

@Configuration
public class WebConfig {

    @org.springframework.web.bind.annotation.ControllerAdvice
   static class ControllerAdvice{
        @ModelAttribute("mm")
       public String addReturnModel(){
           return "mama";
       }
   }

    @Controller
    static class Controller1{
        @ResponseStatus(HttpStatus.OK)
        public ModelAndView foo(User uSe){
            System.out.println("foo,.,");
            return null;
        }
        @ModelAttribute("bar")
        public String bar(){
            System.out.println("bar,.,");
            return "bar";
        }
    }
    @Data
    static class User{
         private String name;
         private Integer age;
    }
}
